<!--<template>-->
<!--  <div class="pwd">-->
<!--    <div class="title3">-->
<!--      修改密码表单-->
<!--    </div>-->
<!--    <el-form :model="ruleForm"  label-width="100px" class="demo-ruleForm">-->
<!--      <el-form-item label="请输入旧密码" prop="oldPass" class="inputpwdtitle">-->
<!--        <el-input type="password" v-model="ruleForm.oldPass" autocomplete="off" class="inputpwd" show-password></el-input>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="请输入新密码" prop="newPass" class="inputpwd2">-->
<!--        <el-input type="password" v-model="ruleForm.newPass" autocomplete="off" class="inputpwd2" show-password></el-input>-->
<!--      </el-form-item>-->

<!--      <el-form-item>-->
<!--        <el-button type="primary" @click="submitForm">提交</el-button>-->
<!--      </el-form-item>-->
<!--    </el-form>-->

<!--  </div>-->
<!--</template>-->

<!--<script>-->
<!--import axios from "axios";-->

<!--export default {-->
<!--  data() {-->
<!--  return {-->
<!--  ruleForm: {-->
<!--    oldPass: '',-->
<!--    newPass: '',-->
<!--    uid:'',-->
<!--  },-->
<!--    userInfo:{-->

<!--    }-->

<!--}},-->


<!--  methods: {-->

<!--    async  submitForm() {-->
<!--      localStorage.getItem('user')-->
<!--      console.log(this.ruleForm);-->
<!--      this.userInfo = JSON.parse(localStorage.getItem('user'))-->
<!--      // 获取用户id-->
<!--      // console.log(this.userInfo.uid)-->
<!--      this.ruleForm.uid = this.userInfo.uid-->
<!--      let res = await axios.post('/day19_04_ssm_crud_war/users/editPassword', this.ruleForm);-->
<!--      console.log(res);-->
<!--      //提示用户操作 结果-->
<!--      //成功&#45;&#45;1.关闭弹窗   2.重新刷新当前页的数据-->
<!--      if (res.data.code == 1) {-->
<!--        this.$message({-->
<!--          message: '修改密码成功',-->
<!--          type: 'success'-->
<!--        })-->
<!--      } else {-->
<!--        this.$message({-->
<!--          message: '添加密码失败,请检查原始密码是否正确',-->
<!--          type: 'error'-->
<!--        })-->
<!--      }-->
<!--    }-->
<!--  },}-->


<!--</script>-->

<!--<style lang="less" scoped>-->
<!--.pwd{-->
<!--  width: 100%;-->
<!--  padding: 30px;-->
<!--}-->
<!--.demo-ruleForm{-->
<!--  width: 400px;-->
<!--  height: 200px;-->
<!--  background: white;-->
<!--  margin:50px;-->
<!--  padding: 50px;-->
<!--  margin-left: 280px;-->
<!--}-->
<!--.inputpwd{-->
<!--  width: 300px;-->


<!--}-->
<!--.inputpwdtitle{-->
<!--}-->
<!--.inputpwd2{-->
<!--  width: 300px;-->


<!--}-->

<!--  .title3{-->
<!--    width: 100%;-->
<!--    height: 60px;-->
<!--    color: #6459ed;-->
<!--    font-weight: 600;-->
<!--    text-align: center;-->
<!--    line-height: 60px;-->
<!--    margin-bottom: 30px;-->
<!--    font-size: 30px;-->
<!--    margin-top: 20px;-->
<!--  }-->


<!--</style>-->




<template>
  <div>
    <div class="pwd">
      <div class="title3">
        修改密码表单
      </div>
        <el-form :model="forData" label-width="100px" class="demo-ruleForm">
          <el-form-item label="原始密码">
            <el-input v-model="forData.oldPassword" class="inputpwdtitle"></el-input>
          </el-form-item>
          <el-form-item label="新密码">
            <el-input v-model="forData.newPassword" class="inputpwd2" show-password></el-input>
          </el-form-item>
          <el-form-item class="button">
            <el-button class="btn" type="primary" @click="submitBtn">确认修改</el-button>
          </el-form-item>

        </el-form>



    </div>
  </div>
</template>

<script>
import axios from 'axios';
export default {
  data() {
    return {
      forData: {
        oldPassword: "",
        newPassword: "",
        uid:""
      },
      userInfo:{

      }
    };
  },
  methods:{
    async  submitBtn(){
      localStorage.getItem('user')
      console.log(this.forData);
      this.userInfo = JSON.parse(localStorage.getItem('user'))
      // 获取用户id
      // console.log(this.userInfo.uid)
      this.forData.uid=this.userInfo.uid
      let res = await axios.post('/day19_04_ssm_crud_war/users/editPassword',this.forData);
      console.log(res);
      //提示用户操作 结果
      //成功--1.关闭弹窗   2.重新刷新当前页的数据
      if(res.data.code ==1){
        this.$message({
          message:'修改密码成功',
          type:'success'
        })
      }else{
        this.$message({
          message:'添加密码失败,请检查原始密码是否正确',
          type:'error'
        })
      }
    }
  }

}
</script>

<style lang="less" scoped>
.pwd{
  width: 100%;
  padding: 30px;
}
.demo-ruleForm{
  width: 400px;
  height: 200px;
  background: white;
  padding: 50px;
  margin-left: 220px;
}
.inputpwd{
  width: 300px;


}
.inputpwdtitle{
}
.inputpwd2{
  width: 300px;


}

  .title3{
    width: 100%;
    height: 60px;
    color: #6459ed;
    font-weight: 600;
    text-align: center;
    line-height: 60px;
    font-size: 30px;
    margin-top: 20px;
  }
.button{
  margin-left: 69px;
}

</style>
